const mongoose = require('mongoose')
const schema = new mongoose.Schema({
  name: { type: String },
  username: { type: String },
  password: {
    type: String,
    select: false,
    set(val) {
      return require('bcrypt').hashSync(val, 12)
    },
  },
  desc: { type: String },
  avatar: { type: String },
})

module.exports = mongoose.model('User', schema)
